package com.cloudbroker.openapi.manage.controller;


import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import com.cloudbroker.bcs.platform.dav.bizapi.service.viewpoint.vo.BrokerInfoPlatForm;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.customer.back.InvestAccountListBackForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.customer.vo.InvestAccountForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.result.InvestBranchNames;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.result.InvestCheckDetailsForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.result.InvestCheckListResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.result.InvestDetailsForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.vo.BrokerFundFrozenForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.vo.InvestBorkerIdForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.vo.BranchNoForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.vo.InvestCheckBrokerForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.vo.InvestCheckForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.vo.InvestCheckListForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.operate.vo.InvestCheckProcessForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.operate.InvestListT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;

/**
 * Created by Lnq on 2016/8/17.
 */
@Controller
public class InvestController {

    @Resource
    InvestListT2BizService investListT2;

    /**
     * 投顾审核列表
     */
    @ResponseBody
    @RequestMapping("/func_invest_check_list")
    @SaveLog(remark = "投顾审核列表")
    public InvestCheckListResult funcInvestCheckList(HttpServletRequest request, String jsonpcallback) {
        InvestCheckListForm form = getSingleParameterMapForBody(request, InvestCheckListForm.class);
        return VOUtil.setJsonpResult(investListT2.funcInvestCheckList(form), jsonpcallback);
    }

    /**
     * 投顾审核流程配置
     */
    @ResponseBody
    @RequestMapping("/func_invest_check_process")
    @SaveLog(remark = "投顾审核流程配置")
    public HSBCPSBackVO funcInvestCheckProcess(HttpServletRequest request, String jsonpcallback) {
        InvestCheckProcessForm form = getSingleParameterMapForBody(request, InvestCheckProcessForm.class);
        return VOUtil.setJsonpResult(investListT2.funcInvestCheckProcess(form), jsonpcallback);
    }

    /**
     * 投顾审核
     */
    @ResponseBody
    @RequestMapping("/func_invest_check")
    @SaveLog(remark = "投顾审核")
    public HSBCPSBackVO funcInvestCheck(HttpServletRequest request, String jsonpcallback){
        InvestCheckForm form = getSingleParameterMapForBody(request,InvestCheckForm.class);
        return VOUtil.setJsonpResult(investListT2.funcInvestCheck(form), jsonpcallback);
    }

    /**
     * 投顾审核列表
     */
    @ResponseBody
    @RequestMapping("/func_invest_check_details")
    @SaveLog(remark = "获取审核列表投顾详情")
    public InvestCheckDetailsForm funcInvestCheckDetails(HttpServletRequest request, String jsonpcallback){
        InvestCheckBrokerForm form = getSingleParameterMapForBody(request,InvestCheckBrokerForm.class);
        return VOUtil.setJsonpResult(investListT2.funcInvestCheckDetails(form), jsonpcallback);
    }

    /**
     * 历史查询
     */
    @ResponseBody
    @RequestMapping("/func_invest_account_list")
    @SaveLog(remark = "获取在职或限制投顾列表")
    public InvestAccountListBackForm funcInvestAccountList(HttpServletRequest request, String jsonpcallback) {
        InvestAccountForm form = getSingleParameterMapForBody(request, InvestAccountForm.class);
        return VOUtil.setJsonpResult(investListT2.funcInvestAccountList(form), jsonpcallback);
    }

    /**
     * 限制、激活投顾
     */
    @ResponseBody
    @RequestMapping("/func_operate_invest_list")
    @SaveLog(remark = "限制或者激活投顾")
    public HSBCPSBackVO funcOperateInvestList(HttpServletRequest request, String jsonpcallback) {
        BrokerFundFrozenForm form = getSingleParameterMapForBody(request, BrokerFundFrozenForm.class);
        return VOUtil.setJsonpResult(investListT2.funcOperateInvestList(form), jsonpcallback);
    }

    /**
     * 获取归属地
     */
    @ResponseBody
    @RequestMapping("/func_get_branch_names")
    @SaveLog(remark = "获取归属地")
    public InvestBranchNames funcGetBranchNames(HttpServletRequest request, String jsonpcallback) {
        BranchNoForm form = getSingleParameterMapForBody(request, BranchNoForm.class);
        return VOUtil.setJsonpResult(investListT2.funcGetBranchNames(form), jsonpcallback);
    }

    /**
     *获取投顾详情
     */
    @ResponseBody
    @RequestMapping("/func_get_invest_details")
    @SaveLog(remark = "获取投顾详情")
    public InvestDetailsForm funcGetInvestDetails(HttpServletRequest request, String jsonpcallback){
        InvestBorkerIdForm form = getSingleParameterMapForBody(request,InvestBorkerIdForm.class);
        return VOUtil.setJsonpResult(investListT2.funcGetInvestDetails(form),jsonpcallback);
    }

    /**
     *公共平台修改投顾信息
     */
    @ResponseBody
    @RequestMapping("/func_invest_change_info")
    @SaveLog(remark = "公共平台修改投顾信息")
    public HSBCPSBackVO funcInvestChangeInfo(HttpServletRequest request, String jsonpcallback){
        BrokerInfoPlatForm form = getSingleParameterMapForBody(request,BrokerInfoPlatForm.class);
        return VOUtil.setJsonpResult(investListT2.funcInvestChangeInfo(form),jsonpcallback);
    }
}